package com.thomasbrault.display 
{
	import flash.display.Loader;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.system.LoaderContext;		

	/**
	 * @author thomas
	 */
	public class AbstractLoader extends Loader 
	{
		public function AbstractLoader( $url : String = null )
		{
			directLoad($url);
		}
		
		public function directLoad ( $url : String , $context : LoaderContext = null ) : void
		{
			
			contentLoaderInfo.addEventListener(Event.COMPLETE, _complete);
			super.load(new URLRequest($url),$context);
		}
		
		
		private function _complete(event : Event) : void
		{
			trace('c')
			contentLoaderInfo.addEventListener(Event.COMPLETE, _complete);
			dispatchEvent(new Event(Event.COMPLETE));
		}
	}
}
